<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWyTicketFinancialStatusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wy_ticket_financial_status', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('type')->comment('1. 定制推荐 2. 人才推荐 3. 招商推荐 4. 下级合伙人（推荐人为一级合伙人并且有二级合伙人上级）');
            $table->string('referrer_name', 50)->comment('推荐人姓名');
            $table->string('account_name', 50)->comment('银行账户开户人姓名');
            $table->string('bank_account_card', 50)->comment('银行卡号');
            $table->decimal('bonus', 11, 2)->comment('奖金');
            $table->decimal('deduct_percentage', 9, 1)->comment('当type=1,4时设置');
            $table->integer('referrer_id')->index()->comment('推荐人id（奖金去向）');
            $table->integer('merchant_id')->index()->comment('商家id（总后台为0）');
            $table->tinyInteger('source_id')->comment('奖金来源id，根据type的值来确定保存哪张表的外键（type：1=>定制推荐订单表，2=>人才推荐审核表，3=>门店加盟审核表，4=>对应定制推荐订单表）');
            $table->string('admin_id', 50)->comment('操作管理员id');
            $table->tinyInteger('status')->comment('处理状态 0待转账，1. 已转账');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wy_ticket_financial_status');
    }
}
